package cn.db101.jcc.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;

// Auto generate by mybatis-flex, do not modify it.
public class UserTableDef extends TableDef {

    /**
     * 用户ID
     */
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 用户性别，1: 男性，2: 女性
     */
    public final QueryColumn GENDER = new QueryColumn(this, "gender");

    /**
     * 微信开放ID，唯一标识
     */
    public final QueryColumn OPEN_ID = new QueryColumn(this, "open_id");

    /**
     * 用户昵称
     */
    public final QueryColumn NICK_NAME = new QueryColumn(this, "nick_name");

    /**
     * 用户头像URL
     */
    public final QueryColumn AVATAR_URL = new QueryColumn(this, "avatar_url");

    /**
     * 创建时间
     */
    public final QueryColumn CREATED_AT = new QueryColumn(this, "created_at");

    /**
     * 更新时间
     */
    public final QueryColumn UPDATED_AT = new QueryColumn(this, "updated_at");

    /**
     * 会话密钥，用于用户数据加解密
     */
    public final QueryColumn SESSION_KEY = new QueryColumn(this, "session_key");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, GENDER, OPEN_ID, NICK_NAME, AVATAR_URL, CREATED_AT, UPDATED_AT, SESSION_KEY};

    public UserTableDef() {
        super("", "t_user");
    }

    private UserTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public UserTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new UserTableDef("", "t_user", alias));
    }

}
